package com.mmall.concurrency.singleton;

import com.mmall.concurrency.annotations.ThreadSafe;
import lombok.extern.slf4j.Slf4j;

/**
 * 饿汉模式
 * 单例实例在装载的时候进行创建
 */
@ThreadSafe
@Slf4j
public class Single2 {
    //私有构造
    private Single2(){

    }
    // 单例
    private static Single2 instance = new Single2();
    // 工厂类
    public static Single2 getInstance(){
        return instance;
    }

}
